// Person.java
//
// Informatics 102 Spring 2012
// Code Example
//
// This is a straightforward Person class, which we'll write unit tests
// against in the PersonTest class.  There is an intentional bug here,
// where the getName() method returns the wrong result, so that a test
// will fail.  Try fixing the bug and watching the test succeed
// afterward.

package quickUnit.inf102.personexample;


public class Person
{
	private String name;
	private String phoneNumber;
	
	
	// The use of this() as a method call is only permitted in the
	// first line of a constructor.  It allows one constructor to call
	// another constructor.  This can cut down on code duplication, as
	// multiple constructors won't have to contain the same code.
	public Person()
	{
		this(null, null);
	}

	
	public Person(String name)
	{
		this(name, null);
	}
	
	
	public Person(String name, String phoneNumber)
	{
		this.name = name;
		this.phoneNumber = phoneNumber;
	}


	public String getName()
	{
		return phoneNumber;
	}
	
	
	public void setName(String name)
	{
		this.name = name;
	}
	
	
	public String getPhoneNumber()
	{
		return phoneNumber;
	}
	
	
	public void setPhoneNumber(String phoneNumber)
	{
		this.phoneNumber = phoneNumber;
	}
	
	
	public String toString()
	{
		return "Person(" + name + ", " + phoneNumber + ")";
	}
}
